package com.buddies.lottery.ui.lottery.bet;

import com.buddies.lottery.R;
import com.buddies.lottery.data.bean.LotteryBetRecord;
import com.buddies.lottery.utils.DateUtils;
import com.buddies.lottery.utils.LotteryUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.List;

public class LotteryBetRecordAdapter extends BaseQuickAdapter<LotteryBetRecord, BaseViewHolder> {

    public LotteryBetRecordAdapter(List<LotteryBetRecord> data) {
        super(R.layout.item_lottery_bet_record, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, LotteryBetRecord item) {
        ((SimpleDraweeView) helper.getView(R.id.image)).setImageURI(item.lottery.pic_url);
        helper.setText(R.id.tv_category, item.lottery.name);
        helper.setText(R.id.tv_period, LotteryUtils.formatLotteryPeriod(item.period));
        helper.setText(R.id.tv_time, DateUtils.format(item.create_at * 1000));
        helper.setText(R.id.tv_money, String.format("%s @%sx%s", item.option.name, item.option.odds, item.money));
        helper.getView(R.id.tv_money).setSelected(true);
        helper.setText(R.id.tv_status, item.getStatus());
    }

}
